﻿
<%namespace YouHP.Model%>
<%namespace YouHP.Utility%>

<%template _Header%>
<style>
.receiver_input
{
	border:1px solid #808080;
}
.receiver_input .f_button
{
	float:right;
margin:3px 2px 0 0;
padding:3px 2px 0 0;
position:relative;
}   
    
.myfriendlist {
background:#FFFFFF none repeat scroll 0 0;
border:1px solid #98B1C8;
padding:2px;
position:absolute;
right:-3px;
top:25px;
}
.myfriendlist .myfriendlist_bar
{
	background:#F2F6FB none repeat scroll 0 0;
border-bottom:1px solid #EEEEEE;
color:#000000;
height:20px;
padding:2px 5px;

}

.myfriendlist .myfriendlist_lst
{
	height:150px;
	padding:2px;
}
.myfriendlist .myfriendlist_bottom
{
	padding:5px;
}
.myfriendlist .item
{
	width:120px;
	float:left;
	margin-bottom:3px;
}
.myfriendlist_bottom a
{
	color:Green!important;
	text-decoration:underline;
	font-size:14px!important;
}
</style>

<div class="layout2-cols2">
<%template _memmenu%>
<div class="pannelcontent">

<div class="pcontent">
<div class="panneldetail">
			<div class="panneltabs">
<%csharp%> TempUrl = "/User/ActionList.aspx?uid="+UserData.Id;<%/csharp%>
					 <a href="{this.GetUrl(TempUrl)}"
					  <%if {PageName}=="actionlist.aspx"%>
					  class="current"
					  <%/if%>>我收到的互动</a>
					  
					   <a href="{this.GetUrl("/User/ActionSend.aspx")}"
					  <%if {PageName}=="actionsend.aspx"%>
					  class="current"
					  <%/if%>>给病友发互动</a>
	
			</div>	
<div class="pannelbody">


<div class="box" id="sendaction">
<div class="pl_title"><span style="float: left;">给病友发互动</span></div>
  <form id="selectfriend">
  <div style="padding:10px; width:500px;">
    <div class="receiver_input">
            <div  class="f_button">
                <div onclick="showdiv();">
                <img  id="extend_icon" src="/support/alpha/images/xx_xx1.gif" style="cursor:pointer;" onmouseout="this.src='/support/alpha/images/xx_xx1.gif';" onmouseover="this.src='/support/alpha/images/xx_xx2.gif'"; />
                </div>
                <div id="myfriendlist" class="myfriendlist" style="display:none; width:400px;">
                    <div class="myfriendlist_bar">请选择发送对象</div>
                  
                    <div id="flist" class="myfriendlist_lst" style="overflow-y: scroll; overflow-x: scroll;">
                    <%csharp%>
                    int j=0;
                    foreach(UserInfo item in FriendList){
                    <%/csharp%>
                    <%csharp%>if(j>0 && j%3==0){<%/csharp%>
                    <div style="clear:both;"></div>
                    <%csharp%> }<%/csharp%>
                    <div class="item"><input name="checkbox" id="chekbox_{j}" type="checkbox" value="{item.UserName}" />&nbsp;<font style="color:Green;">{item.UserName}</font></div>
                  

                    <%csharp%> j++;}<%/csharp%>
                    </div>
              
                    <div class="myfriendlist_bottom"><a href="javascript:" onclick="selectall();">全选</a>&nbsp;<a href="javascript:" onclick="cancellall();">全不选</a>&nbsp;&nbsp;&nbsp;&nbsp;
                    <input type="button" onclick="flist_submit();"  title="确定" value="确定" id="btn_qd"/>&nbsp;
                    <input type="button" onclick="_$('myfriendlist').style.display='none';"  title="关闭" value="关闭" id="btn_gb"/>&nbsp;
                    </div>
               </div>
			    
            </div>
        
            <div style=" height:23px;">
            <input name="receivers" id="receivers" type="text" style="color:#aaa;border:0 none;"  size="40" value="请输入用户名，并用分号隔开" onfocus="OnEnter(this);" onblur="OnExit(this);" />
            </div>
	                          
   </div>
   </div>
 </form>         
  <form id="huglist">   
    <table width="95%">                            
        <tr>
      
            <%csharp%> for (int i=0; i < Constants.HugTypeCount; i ++) { <%/csharp%>
            <td width="80">
            <table>
                <tr height="35"><td align="center"><img src="{Utils.GetHugUrl(i)}"  /></td></tr>
                <tr height="20"><td align="center"><span>{Utils.GetHugText(i)}</span></td></tr>
                <tr height="20"><td align="center">
                    <input type="radio" class="radio" id="face{i}" name="hugtype" value="{i}" />
                </td></tr>
            </table></td>
            <%csharp%> } <%/csharp%>
           <td>&nbsp;&nbsp;</td>
        </tr>
    </table>
</form>
    <script type="text/javascript">
        _$('face0').checked = true;
    </script>
    
    <div class="bor"> 
        <textarea name="appendmsg" style="width:500px; height:100px;" id="appendmsg" class="rev_textarea" style="color:rgb(170, 170, 170);" onfocus="OnEnter(this);" onblur="OnExit(this);">随便说两句....</textarea>
    </div>
    <p style="padding:10px;">
    <span  onmouseout="this.className='new_sbt'" onmouseover="this.className='new_sbt_h'" onclick="DataPost();" class="new_sbt" id="submitbutton">发送</span>
    </p>

</div>

 <script type="text/javascript">
       function showdiv()
    {
    
      _$("receivers").value = "";
      var e = _$('myfriendlist').style.display;
      if(e == 'none')
      {
          _$('myfriendlist').style.display = 'block';
          _$('extend_icon').src="/support/alpha/images/xx_xs1.gif";
          _$('extend_icon').onmouseout="this.src='/support/alpha/images/xx_xs1.gif';"
          _$('extend_icon').onmouseover="this.src='/support/alpha/images/xx_xs2.gif'"
      }
      else
      {
          _$('myfriendlist').style.display = 'none';
          _$('extend_icon').src="/support/alpha/images/xx_xx1.gif";
          _$('extend_icon').onmouseout="this.src='/support/alpha/images/xx_xx1.gif';"
          _$('extend_icon').onmouseover="this.src='/support/alpha/images/xx_xx2.gif'"
      }
    }
 

	function flist_submit()
	{
	
        var name_array=[];
        var form = _$('selectfriend');
        var j = 0;
        for(var i = 0;i < form.elements.length;i++)
        {
          var e = form.elements[i];
          if(e.name == "checkbox")
          {
             if(e.checked == true)
             {
                 name_array[j] = e.value;
                 j++;
             }
          }
        }   
        for( var k = 0;k < name_array.length;k++)
        {
            if(k == name_array.length-1)
               _$("receivers").value += name_array[k];
            else
               _$("receivers").value += name_array[k] + ";";
        }
       
        _$('myfriendlist').style.display = 'none';
        _$('extend_icon').src="/support/alpha/images/xx_xx1.gif";
        _$('extend_icon').onmouseout="this.src='/support/alpha/images/xx_xx1.gif';"
        _$('extend_icon').onmouseover="this.src='/support/alpha/images/xx_xx2.gif'"

	}
	function selectall()
	{
	    var form = _$('selectfriend');
        for(var i = 0;i < form.elements.length;i++)
        {
          var e = form.elements[i];
          if(e.name == "checkbox" && e.checked == false)
          {
             e.checked = true;
               
          }
        }   	
	}

	function cancellall()
	{
	    var form = _$('selectfriend');
        for(var i = 0;i < form.elements.length;i++)
        {
          var e = form.elements[i];
          if(e.name == "checkbox" && e.checked == true)
          {
             e.checked = false;
               
          }
        }   
	}
    
    function DataPost()
    { 
        var receivers = _$("receivers").value.trim();
        if(receivers.length == 0 || receivers == _$("receivers").defaultValue)
        {
           alert("接收人不能为空！");
           return;
        }
        var msg = _$("appendmsg").value;
        if(msg== _$("appendmsg").defaultValue)  msg="";
        if(msg.length > 300 ) 
        {
            alert("陈述内容不能超过300个字！");
            return;
        }
        
         var actiontype = 0;
          var form = _$('huglist');
          for(var i = 0;i < form.elements.length;i++)
          {
              var e = form.elements[i];
              if(e.name == "hugtype")
              {
                 if(e.checked == true)
                 {
                     actiontype = e.value;
                     break;
                 }
              }
           }   
     _$("submitbutton").value = "正在处理...";
     _$("submitbutton").disabled = true;
      var aurl = "/Pages/alpha/Ajax/ActionSendAjax.aspx?msg="+msg.escUrl()+"&actiontype="+actiontype+"&receivers="+receivers.escUrl();
      var myAjax=new Ajax(aurl,
      {
         method:'get',
         onComplete:function()
         {
           alert(this.response.text);
           _$("submitbutton").disabled = false;
          }
       }
       );
       myAjax.request();
    }
       
    </script>
</div>
</div>
</div>
</div>
</div>



<%template _footer%>		
